package com.lsa.letcode.the67.addBinary;

import static org.junit.Assert.assertEquals;

import java.math.BigInteger;

import org.junit.Test;

public class AddBinaryTest {
	@Test
	public void testName() throws Exception {
		Solution s = new Solution();
		test(s, "101", "11");
		test(s, "1", "1");
		test(s, "1", "11");
		test(s, "1010101010101", "11");
		test(s, "1010101010101", "101");
		test(s, "1010101010101", "0");
		test(s, "0", "0");
		test(s, "0", "1");
		test(s, "1", "1");
		test(s, "10111111111111111111111111111", "1");
	}

	private void test(Solution s, String a, String b) {
		BigInteger biA = new BigInteger(a, 2);
		BigInteger biB = new BigInteger(b, 2);
		assertEquals(biA.add(biB).toString(2), s.addBinary(a, b));
	}
}
